package com.atomgit.ai.proxy.controller;

import com.atomgit.ai.proxy.param.apikey.UserApiKeyAddParam;
import com.atomgit.ai.proxy.param.apikey.UserApiKeyDetailParam;
import com.atomgit.ai.proxy.param.apikey.UserApiKeyRemoveParam;
import com.atomgit.ai.proxy.service.UserApiKeyService;
import com.atomgit.ai.proxy.vo.UserApiKeyDetailVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/apiKey")
public class UserApiKeyController {

    @Autowired
    private UserApiKeyService userApiKeyService;

    /**
     * 设置模型apikey
     */
    @PostMapping("/setting")
    public void setting(@RequestBody @Validated UserApiKeyAddParam param) {
        userApiKeyService.setting(param);
    }

    /**
     * 查看模型apiKey
     */
    @PostMapping("/detail")
    public UserApiKeyDetailVO list(@RequestBody @Validated UserApiKeyDetailParam param) {
       return userApiKeyService.detail(param);
    }

    @PostMapping("/remove")
    public void delete(@RequestBody @Validated UserApiKeyRemoveParam param) {
        userApiKeyService.remove(param);
    }

}
